package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum OperationType {
	
	ADD(0,"储值"),
	PAY(1,"支付");
	
	private Integer value;
	private String text;

	private OperationType(Integer value,String text) {
		this.value = value;
		this.text = text;
	}

	public Integer toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static OperationType toStatus(Integer value) {
		if (ADD.value == value) {
			return ADD;
		} else if (PAY.value == value) {
			return PAY;
		}else {
			throw new InvalidArgumentException("Unknown OperationType[" + value + "].");
		}
	}
}
